﻿using System.Collections;

namespace FrameOperateSync
{
    struct FrameOperateData
    {
        public int Index;
        public int FrameIndex;
        public int KeyFrameIndex;
        public int LogicCode;
        public int PlayerId;
        public byte[] Data;

        public static FrameOperateData Create(int playerId, int keyFrameIndex, int frameIndex,int code,byte[] data)
        {
            FrameOperateData node = new FrameOperateData()
            {
                Index = frameIndex * 1000000 + playerId,
                FrameIndex = frameIndex,
                KeyFrameIndex = keyFrameIndex,
                LogicCode = code,
                PlayerId = playerId,
                Data = data,
            };
            return node;
        }

        public static FrameOperateData Empty(int keyFrameIndex)
        {
            return new FrameOperateData()
            {
                KeyFrameIndex = keyFrameIndex,
                FrameIndex = FrameTicker.FrameIndex(keyFrameIndex, 0),
                Index = FrameTicker.FrameIndex(keyFrameIndex, 0),
                LogicCode = -1,
            };
        }
    }
}
